import 'package:flutter/material.dart';
import 'package:wechat/contacts/contacts_data.dart';
import 'package:wechat/contacts/contacts_header.dart';
import 'package:wechat/contacts/contacts_item.dart';
import 'package:wechat/contacts/contacts_slider_list.dart';

class Contacts extends StatefulWidget {
  const Contacts({super.key});

  @override
  State<Contacts> createState() => _ContactsState();
}

class _ContactsState extends State<Contacts> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: ContactsSliderList(
        items: contactsData,
        headerBuilder: (context, index) {
          return const ContactsHeader();
        },
        itemBuilder: (context, index) {
          return Container(
            color: Colors.white,
            alignment: Alignment.centerLeft,
            child: ContactsItem(item: contactsData[index]),
          );
        },
        sectionBuilder: (context, index) {
          return Container(
            height: 32,
            padding: const EdgeInsets.only(left: 14),
            color: Colors.grey,
            alignment: Alignment.centerLeft,
            child: Text(
              contactsData[index].sectionKey,
              style: const TextStyle(fontSize: 14, color: Color(0xFF333333)),
            ),
          );
        },
      ),
    );
  }
}
